#include "../StdAfx.h"
#include "Weapon.h"
#include "NxActor.h"
#include "NxShape.h"
#include "../Sphere.h"
#include "../Level.h"
#include "../CubePhysX.h"
#include "../Character.h"
#include "../DX10ObjMesh.h"
#include "../Character.h"

Weapon::Weapon(Level* pLevel):
	m_pObject(0),
	m_pTrigger(0),
	m_Mesh(0)
{
	m_pLevel = pLevel;
}

Weapon::~Weapon(void)
{
	delete m_pObject;
	delete m_pTrigger;
}
void Weapon::SetWeaponMesh(DX10ObjMesh* mesh)
{
	m_Mesh = mesh;
}
void Weapon::SetCharacter(Character* character)
{
	m_Character = character;
}
void Weapon::Draw(const RenderContext* context, ID3D10ShaderResourceView* shadowdepthmap) 
{
	if ( m_pObject )
		m_pObject->Draw(context);
}

void Weapon::Initialize(ContentManager* manager)
{
	m_pObject->SetParent(m_pLevel);
	m_pObject->Initialize(manager);
	m_pObject->Translate(m_Position);

	m_pTrigger = new CubePhysX(m_pLevel, 1.5f, 1.5f, 1.5f,D3DXCOLOR(1,1,1,1),CubePhysX::GHOST);
	m_pTrigger->Translate(m_Position);

	m_pTrigger->GetActor()->userData = this;
}